<!DOCTYPE html>
<html lang="en" xmlns:th="https://thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" th:src="@{/static/js/vue.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/axios.min.js}"></script>
</head>
<body>
<h1>用来测试 HttpMessageConvertrt</h1>

<a th:href="@{/converter/responseBody}">测试  的是   responseBody</a><br>
<form th:action="@{/converter/enity}" method="post">
    用户名<input type="text" name="username"><br>
    密码<input type="password" name="password"><br>
    <input type="submit">
</form>


<div id="app">
    <a th:href="@{/converter/testAjax} " @click="testAjax">测试ajax</a>
</div>

<script type="text/javascript">
    var vue=new Vue({
        el:"#app",
        methods:{
            testAjax:function(event){
                axios({
                    method:"post",//method  不要写错
                    url:event.target.href,
                    params:{
                        username:"admin",
                        password:"123456"
                    }
                }).then(function (response) {
                    alert(response.data);
                });
                event.preventDefault();
            }
        }
    });
</script>
</body>
</html>